package demo10;


import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

/**
 * Spring 配置类
 * 注解@Configuration
 *
 * @ComponentScan("demo10") 该注解用于扫描包，默认扫描当前包及其子包
 */
@Configuration
@ComponentScan("demo10")
public class Demo {
    //配置类
    public static void main(String[] args) {
        //
        AnnotationConfigApplicationContext context=
                new AnnotationConfigApplicationContext(Demo.class);
        //配置Spring 容器

        Person person=context.getBean(Person.class);
        System.out.println(person);




    }
}
